package com.dch.calculator.activities.app;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import com.dch.calculator.activities.exception.ExceptionActivity;
import com.dch.calculator.exceptions.CalculatorException;

public class CalculatorActivity extends Activity {

    final protected String LOG_TAG = "APP_LOG";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.d(LOG_TAG, "create activity");
        try {
            performOnCreate(savedInstanceState);
        } catch (CalculatorException e) {
            Intent intent = new Intent(this, ExceptionActivity.class);
            intent.putExtra("title", "");
            intent.putExtra("detail", "");
            startActivity(intent);
        }
    }

    protected void performOnCreate(final Bundle saveInstanceState) throws CalculatorException{}

    @Override
    protected void onStart() {
        super.onStart();
        Log.d(LOG_TAG, "start main activity");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.d(LOG_TAG, "resume main activity");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.d(LOG_TAG, "pause main activity");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.d(LOG_TAG, "stop main activity");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.d(LOG_TAG, "destroy main activity");
    }
}
